From e0db82c3286da81fa8945894dd10125a528299e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9gory=20PLANCHAT?=
 <gplanchat@users.noreply.github.com>
Date: Wed, 8 Jul 2020 10:09:38 +0200
Subject: [PATCH] Fix for PHP 7.3 (#215)

Co-authored-by: Remi Collet <remi@remirepo.net>
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
 zmq.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/zmq.c b/zmq.c
index 66196ea..879704f 100644
--- a/zmq.c
+++ b/zmq.c
@@ -235,7 +235,11 @@ php_zmq_context *php_zmq_context_get(zend_long io_threads, zend_bool is_persiste
 		le.type = php_zmq_context_list_entry();
 		le.ptr  = context;
 
+#if PHP_VERSION_ID < 70300
 		GC_REFCOUNT(&le) = 1;
+#else
+		GC_SET_REFCOUNT(&le, 1);
+#endif
 
 		/* plist_key is not a persistent allocated key, thus we use str_update here */
 		if (zend_hash_str_update_mem(&EG(persistent_list), plist_key->val, plist_key->len, &le, sizeof(le)) == NULL) {
@@ -535,7 +539,11 @@ void php_zmq_socket_store(php_zmq_socket *zmq_sock_p, zend_long type, zend_strin
 	le.type = php_zmq_socket_list_entry();
 	le.ptr  = zmq_sock_p;
 
+#if PHP_VERSION_ID < 70300
 	GC_REFCOUNT(&le) = 1;
+#else
+	GC_SET_REFCOUNT(&le, 1);
+#endif
 
 	plist_key = php_zmq_socket_plist_key(type, persistent_id, use_shared_ctx);
 
-- 
2.31.1

